import request from '@/utils/request'

// 定义应用管理的多个方法
const apiMethods = {
  path: '/application',
  getList(params) {
    return request({
      url: this.path + '/list',
      method: 'get',
      params
    })
  },
  create(data) {
    return request({
      url: this.path + '/save',
      method: 'post',
      data
    })
  },
  update(data) {
    return request({
      url: this.path + '/save',
      method: 'put',
      data
    })
  },
  del(data) {
    return request({
      url: this.path + '/delete',
      method: 'delete',
      data
    })
  },
  info(params) {
    return request({
      url: this.path + '/get',
      method: 'get',
      params
    })
  },
  // 安装应用
  install(data) {
    return request({
      url: this.path + '/install',
      method: 'post',
      data
    })
  },
  // 卸载应用
  uninstall(data) {
    return request({
      url: this.path + '/uninstall',
      method: 'post',
      data
    })
  },
  // 启用应用
  enable(data) {
    return request({
      url: this.path + '/enable',
      method: 'post',
      data
    })
  },
  // 禁用应用
  disable(data) {
    return request({
      url: this.path + '/disable',
      method: 'post',
      data
    })
  },
  // 更新应用
  upgrade(data) {
    return request({
      url: this.path + '/upgrade',
      method: 'post',
      data
    })
  }
};

export default apiMethods;